package meterMonitor.constand;

import java.util.HashMap;
import java.util.Map;

public enum DayOrNightEnum {

    day(10, "白班"), night(20, "夜班");

    private Integer code;

    private String name;

    private DayOrNightEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Map<Integer,String> getEnumMap(){
        Map<Integer,String> map = new HashMap<>();
        DayOrNightEnum[] values =  values();
        for (DayOrNightEnum item : values) {
            map.put(item.code, item.name);
        }
        return map;
    }

    /**
     *
     * @Title: getDescriptionByCode
     * @Description: TODO(得到code对应的中文注�?)
     * @param @param code
     * @param @return    设定文件
     * @return String    返回类型
     * @author shuai.zhu shuai.zhu@china.zhaogang.com
     * @throws
     */
    public static String getDescriptionByCode(Integer code){
        DayOrNightEnum[] values =  values();
        for (DayOrNightEnum item : values)
        {
            if(item.getCode().equals(code)){
                return item.name();
            }
        }
        return "";
    }
}
